﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using JBeamLibrary.VehicleParts.Groups;
using JBeamLibrary.VehicleParts.Interfaces;

namespace JBeamLibrary.Exceptions
{
    public class InvalidElementException<T> : DriveException where T : class, IVehicleElement
    {
        #region Properties

        public VehicleSection<T> Section { get; private set; }

        public T Element { get; private set; }

        #endregion

        #region CTORs

        public InvalidElementException(VehicleSection<T> section, T element, ArgumentException ex = null)
            : base(string.Format("The following element is not valid for section '{0}' of part '{1}' of file '{2}':{3}{4}", section.Name, section.Part.Name, section.Part.File.Name, Environment.NewLine, element), ex)
        {
            Section = section;
            Element = element;
        }

        #endregion
    }
}
